#include<stdio.h>

int main(void)
{
	int word;
	char ch_now,ch_last;
	char head;
	
	head=getchar();
	if(head==' ')
	{
		word=0;
		ch_last=' ';
	}
	else
	{
		word=1;
		ch_last='a';
	}
	while((ch_now=getchar())!='\n')
	{
		if((ch_last==' ')&&((ch_now>='a'&&ch_now<='z')||(ch_now>='A'&&ch_now<='Z')))
		{
			word++;
		}
		ch_last=ch_now;
	}
	
	printf("%d",word);
	
	return 0;
}

